{{Extend "layout"}}
{{Block "title"}}{{if HasSuffix $.URL.Path "_add"}}{{"添加角色"|$.T}}{{else}}{{"修改角色"|$.T}}{{end}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li><a href="{{BackendURL}}/manager/role">{{"角色列表"|$.T}}</a></li>
<li class="active">{{if HasSuffix $.URL.Path "_add"}}{{"添加"|$.T}}{{else}}{{"修改"|$.T}}{{end}}</li>
{{/Block}}
{{Block "head"}}
{{- range $k, $v := $.Stored.permissionTypes -}}
{{- if $.IsValid $v.X -}}
{{- $head := $v.X.Tmpl `head` -}}
{{- if $head -}}
{{$.Fetch $head $}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/Block}}
{{Block "main"}}
{{Strip}}
<div class="row">
    <div class="col-md-12">
        <div class="block-flat no-padding">
          <div class="header">							
            <h3>
              {{if HasSuffix $.URL.Path "_add"}}
              {{"添加角色"|$.T}}
              {{else}}
              {{"修改角色"|$.T}}
              {{end}}
            </h3>
          </div>
          <div class="content">
              <form class="form-horizontal group-border-dashed" method="POST" action="">
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"角色名"|$.T}}</label>
                <div class="col-sm-9">
                    <input type="text" class="form-control" required name="name" value="{{$.Form "name"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"说明"|$.T}}</label>
                <div class="col-sm-9">
                  <textarea class="form-control" name="description">{{$.Form "description"}}</textarea>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"状态"|$.T}}</label>
                <div class="col-sm-9">
                  {{$v := $.Form "disabled"}}
                  <span class="radio radio-success radio-inline">
                      <input type="radio" value="N" name="disabled"{{if eq $v `N` ``}} checked{{end}} id="disabled-N"> <label for="disabled-N">{{"启用"|$.T}}
                    </label>
                    </span>
                    <span class="radio radio-danger radio-inline">
                      <input type="radio" value="Y" name="disabled"{{if eq $v `Y`}} checked{{end}} id="disabled-Y"> <label for="disabled-Y">{{"禁用"|$.T}}
                    </label>
                  </span>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"权限"|$.T}}</label>
                <div class="col-sm-9">
                  <div class="tab-container">
                    <ul class="nav nav-tabs">
                      {{- range $k, $v := $.Stored.permissionTypes -}}
                      {{- if $.IsValid $v.X -}}
                      <li{{if eq $k 0}} class="active"{{end}}><a href="#perm-tab-{{$v.K}}" data-toggle="tab">{{$v.V}}</a></li>
                      {{- end -}}
                      {{- end -}}
                    </ul>
                    <div class="tab-content" id="perm-settings">
                      {{- range $k, $v := $.Stored.permissionTypes -}}
                      {{- if $.IsValid $v.X -}}
                      <div class="tab-pane{{if eq $k 0}} active{{end}}" id="perm-tab-{{$v.K}}">
                      {{$.Fetch $v.X.Tmpl $}}
                      </div>
                      {{- end -}}
                      {{- end -}}
                    </div>
                  </div>
                </div>
              </div>
              <div class="form-group form-submit-group">
									<div class="col-sm-9 col-sm-offset-2">
									  <button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-save"></i> {{"保存"|$.T}}</button>
									  <button type="reset" class="btn btn-default btn-lg"><i class="fa fa-refresh"></i> {{"重置"|$.T}}</button>
									</div>
							</div>
            </form>
          </div><!-- /.content -->
        </div><!-- /.block-flat -->
    </div>
</div>
{{/Strip}}
{{/Block}}
{{Block "footer"}}
{{- range $k, $v := $.Stored.permissionTypes -}}
{{- if $.IsValid $v.X -}}
{{- $foot := $v.X.Tmpl `foot` -}}
{{- if $foot -}}
{{$.Fetch $foot $}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/Block}}